package org.ls.petclinic.dao.impl;

import org.ls.petclinic.dao.VetDao;
import org.ls.petclinic.pojo.Vet;

import java.util.List;

/**
 * @Description
 * @Author 浪矢先生
 * @Create 2022-06-09 23:33
 */
public class VetDaoImpl extends BaseDao implements VetDao {
    @Override
    public List<Vet> getVetList() {
        String sql="select * from vet";
        return queryForList(Vet.class, sql);
    }

    @Override
    public int deleteVetById(int id) {
        String sql="delete from vet where id=?";
        return update(sql, id);
    }

    @Override
    public int addVet(Vet vet) {
        String sql="insert into vet(name,specialty,other)values(?,?,?)";
        return update(sql, vet.getName(),vet.getSpecialty(),vet.getOther());
    }
}
